package com.nl.controller.common.util;

import com.nl.controller.common.global.GlobalEnum;
import com.nl.controller.common.model.Response;

public class ResponseUtil {

    public static Response sucess(Object object, long count) {
        Response response = new Response();
        response.setCode(0);
        response.setMsg("成功");
        response.setCount(count);
        response.setData(object);
        return response;
    }


    public static Response sucess(Object object) {
        Response response = new Response();
        response.setCode(0);
        response.setMsg("成功");
        response.setData(object);
        return response;
    }

    public static Response error(Integer code, String msg) {
        Response response = new Response();
        response.setCode(code);
        response.setMsg(msg);
        return response;
    }

    public static Response error(GlobalEnum resultEnum) {
        Response response = new Response();
        response.setCode(resultEnum.getCode());
        response.setMsg(resultEnum.getMsg());
        return response;
    }
}
